﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:c="clr-namespace:personalplaner.common.controls"
                    xmlns:k="clr-namespace:personalplaner.common.themes">

    <Style TargetType="TextBlock">
        <Setter Property="VerticalAlignment" Value="Center"/>
    </Style>

    <!--<Style TargetType="TextBox" >
        <Setter Property="Margin" Value="1,3,1,1"/>
        <Setter Property="Style" Value="{StaticResource TextBoxStyle}"/>
    </Style>-->

    <Style TargetType="DatePicker">
        <Setter Property="Margin" Value="1,3,1,1"/>
    </Style>

    <!--<Style TargetType="ComboBox">
        <Setter Property="Margin" Value="1,3,1,1"/>
    </Style>-->

    <!-- 
    *****************************************************************
    Button Theme 
    *****************************************************************
    -->
    <Style TargetType="Button" ><!--x:Key="ButtonStyle"-->
        <Setter Property="SnapsToDevicePixels" Value="true"/>
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <!--<Setter Property="Foreground" Value="#727272"/>-->
        <Setter Property="Foreground" Value="#E1000000"/>
        <Setter Property="FontSize" Value="10"/>
        <Setter Property="FontWeight" Value="Heavy"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Border x:Name="Border" CornerRadius="2" BorderThickness="1">
                        <Border.Background>
                            <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                <LinearGradientBrush.GradientStops>
                                    <GradientStop x:Name="Stop1" Color="WhiteSmoke" Offset="0"/>
                                    <GradientStop x:Name="Stop2" Color="LightGray" Offset="1"/>
                                </LinearGradientBrush.GradientStops>
                            </LinearGradientBrush>
                        </Border.Background>
                        <Border.BorderBrush>
                            <SolidColorBrush x:Name="BorderBrush" Color="#FF707070"/>
                        </Border.BorderBrush>
                        <ContentPresenter Margin="2" HorizontalAlignment="Center" VerticalAlignment="Center" RecognizesAccessKey="True"/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsKeyboardFocused" Value="true">
                            <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource CustomSelectedButtonBrush}" />
                        </Trigger>
                        <Trigger Property="IsDefaulted" Value="true">
                            <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource CustomSelectedButtonBrush}" />
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Trigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <ColorAnimation Storyboard.TargetName="Stop1" Storyboard.TargetProperty="Color" Duration="0:0:0.25" To="#FDFADE"/>
                                        <ColorAnimation Storyboard.TargetName="Stop2" Storyboard.TargetProperty="Color" Duration="0:0:0.25" To="#FFEA96"/>
                                        <ColorAnimation Storyboard.TargetName="BorderBrush" Storyboard.TargetProperty="Color" Duration="0:0:0.25" To="Goldenrod"/>
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <ColorAnimation Storyboard.TargetName="Stop1" Storyboard.TargetProperty="Color" Duration="0:0:0.25" />
                                        <ColorAnimation Storyboard.TargetName="Stop2" Storyboard.TargetProperty="Color" Duration="0:0:0.25" />
                                        <ColorAnimation Storyboard.TargetName="BorderBrush" Storyboard.TargetProperty="Color" Duration="0:0:0.25" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.ExitActions>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="true">
                            <Setter TargetName="Border" Property="Background" Value="{StaticResource PressedBrush}" />
                            <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource PressedBorderBrush}" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter TargetName="Border" Property="Background" Value="#80707070" />
                            <Setter TargetName="Border" Property="BorderBrush" Value="#80707070" />
                            <Setter Property="Foreground" Value="#80000000" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <!-- 
    *****************************************************************
    TextBox Theme 
    *****************************************************************
    -->
    <!--<Style TargetType="{x:Type TextBoxBase}" x:Key="TextBoxStyle">-->
    <Style x:Key="{x:Type TextBox}" TargetType="{x:Type TextBox}" >
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="AllowDrop" Value="true"/>
        <Setter Property="Margin" Value="1"/>
        <Setter Property="Validation.ErrorTemplate" Value="{x:Null}"/>
        <Setter Property="Margin" Value="1,3,1,1"/>
        <Setter Property="Template">
            <Setter.Value>
                <!--<ControlTemplate TargetType="{x:Type TextBoxBase}">-->
                <ControlTemplate TargetType="{x:Type TextBox}">
                    <Border Name="Border" CornerRadius="1" Padding="2" BorderThickness="1" Background="#FFFFFFFF" BorderBrush="#FF888888" >
                        <ScrollViewer Margin="0" x:Name="PART_ContentHost"/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="Border" Property="Background" Value="#EEE"/>
                            <Setter TargetName="Border" Property="BorderBrush" Value="#C4C4C4"/>
                            <Setter Property="Foreground" Value="#888"/>
                        </Trigger>
                        <Trigger Property="IsKeyboardFocused" Value="true">
                            <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource CustomSelectedButtonBrush}" />
                        </Trigger>
                        <Trigger Property="Validation.HasError" Value="true">
                            <Setter TargetName="Border" Property="BorderBrush" Value="Red"/>
                            <Setter Property="ToolTip" Value="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=(Validation.Errors)[0].ErrorContent}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- 
    *****************************************************************
    PasswordBox Theme 
    *****************************************************************
    -->
    <Style x:Key="{x:Type PasswordBox}" TargetType="{x:Type PasswordBox}">
        <Setter Property="SnapsToDevicePixels" Value="true" />
        <Setter Property="OverridesDefaultStyle" Value="true" />
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="PasswordChar" Value="*" />
        <Setter Property="MinHeight" Value="20" />
        <Setter Property="AllowDrop" Value="true" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type PasswordBox}">
                    <Border x:Name="Border" CornerRadius="2" Padding="2" Background="#FFFFFFFF" BorderBrush="#FF888888" BorderThickness="1">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="Disabled" />
                                <VisualState x:Name="MouseOver" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <ScrollViewer x:Name="PART_ContentHost" />
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="Border" Property="Background" Value="#EEE"/>
                            <Setter TargetName="Border" Property="BorderBrush" Value="#C4C4C4"/>
                            <Setter Property="Foreground" Value="#888"/>
                        </Trigger>
                        <Trigger Property="IsKeyboardFocused" Value="true">
                            <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource CustomSelectedButtonBrush}" />
                        </Trigger>
                        <Trigger Property="Validation.HasError" Value="true">
                            <Setter TargetName="Border" Property="BorderBrush" Value="Red"/>
                            <Setter Property="ToolTip" Value="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=(Validation.Errors)[0].ErrorContent}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    
    <!-- 
    *****************************************************************
    NumericTextBox Theme 
    *****************************************************************
    -->
    <Style TargetType="{x:Type c:NumericTextBox}" BasedOn="{StaticResource {x:Type TextBox}}">

    </Style>

    
    <!-- 
    *****************************************************************
    MaskedTextBox Theme 
    *****************************************************************
    -->
    <Style TargetType="{x:Type c:MaskedTextBox}" BasedOn="{StaticResource {x:Type TextBox}}">

    </Style>


    <!-- 
    *****************************************************************
    ComboBox Theme 
    *****************************************************************
    -->
    <ControlTemplate x:Key="ComboBoxToggleButton" TargetType="ToggleButton">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition Width="14" />
            </Grid.ColumnDefinitions>
            <Border x:Name="Border" Grid.ColumnSpan="2" CornerRadius="2" BorderThickness="1">
                <Border.Background>
                    <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                        <LinearGradientBrush.GradientStops>
                            <GradientStop x:Name="Stop1" Color="WhiteSmoke" Offset="0"/>
                            <GradientStop x:Name="Stop2" Color="LightGray" Offset="1"/>
                        </LinearGradientBrush.GradientStops>
                    </LinearGradientBrush>
                </Border.Background>
                <Border.BorderBrush>
                    <SolidColorBrush x:Name="BorderBrush" Color="#FF707070"/>
                </Border.BorderBrush>
            </Border>
            <Path x:Name="Arrow" Grid.Column="1" Fill="#FF888888" HorizontalAlignment="Center" VerticalAlignment="Center" Data="M -2 0 L 2 4 L 6 0 Z"/>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="ToggleButton.IsMouseOver" Value="true">
                <Trigger.EnterActions>
                    <BeginStoryboard>
                        <Storyboard>
                            <ColorAnimation Storyboard.TargetName="Stop1" Storyboard.TargetProperty="Color" Duration="0:0:0.25" To="#FDFADE"/>
                            <ColorAnimation Storyboard.TargetName="Stop2" Storyboard.TargetProperty="Color" Duration="0:0:0.25" To="#FFEA96"/>
                            <ColorAnimation Storyboard.TargetName="BorderBrush" Storyboard.TargetProperty="Color" Duration="0:0:0.25" To="Goldenrod"/>
                        </Storyboard>
                    </BeginStoryboard>
                </Trigger.EnterActions>
                <Trigger.ExitActions>
                    <BeginStoryboard>
                        <Storyboard>
                            <ColorAnimation Storyboard.TargetName="Stop1" Storyboard.TargetProperty="Color" Duration="0:0:0.25" />
                            <ColorAnimation Storyboard.TargetName="Stop2" Storyboard.TargetProperty="Color" Duration="0:0:0.25" />
                            <ColorAnimation Storyboard.TargetName="BorderBrush" Storyboard.TargetProperty="Color" Duration="0:0:0.25" />
                        </Storyboard>
                    </BeginStoryboard>
                </Trigger.ExitActions>
            </Trigger>
            <Trigger Property="ToggleButton.IsChecked" Value="true">
                <Setter TargetName="Border" Property="Background" Value="{StaticResource PressedBrush}" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="false">
                <Setter TargetName="Border" Property="BorderBrush" Value="#C4C4C4"/>
                <Setter TargetName="Border" Property="Background">
                    <Setter.Value>
                        <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                            <LinearGradientBrush.GradientStops>
                                <GradientStop Color="#EEE" Offset="0"/>
                                <GradientStop Color="#EEE" Offset="1"/>
                            </LinearGradientBrush.GradientStops>
                        </LinearGradientBrush>
                    </Setter.Value>
                </Setter>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <ControlTemplate x:Key="ComboBoxTextBox" TargetType="TextBox">
        <Border x:Name="PART_ContentHost" Focusable="False" Background="{TemplateBinding Background}" />
    </ControlTemplate>

    <Style x:Key="ComboBoxFocusVisual">
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate>
                    <Border BorderBrush="Goldenrod" Background="Transparent" BorderThickness="1" CornerRadius="2">
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style  TargetType="ComboBox"><!--x:Key="ComboBoxStyle"-->
        <Setter Property="SnapsToDevicePixels" Value="true"/>
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
        <Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
        <Setter Property="Margin" Value="1"/>
        <Setter Property="FocusVisualStyle" Value="{StaticResource ComboBoxFocusVisual}"/>
        <Setter Property="Margin" Value="1,3,1,1"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ComboBox" >
                    <Grid>
                        <ToggleButton Name="ToggleButton" Template="{StaticResource ComboBoxToggleButton}" Focusable="false" IsChecked="{Binding Path=IsDropDownOpen,Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}}" ClickMode="Press"/>
                        <ContentPresenter Name="ContentSite" IsHitTestVisible="False" Content="{TemplateBinding SelectionBoxItem}" ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" Margin="3,3,23,3" VerticalAlignment="Center" HorizontalAlignment="Left" />
                        <Popup Name="Popup" Placement="Bottom" IsOpen="{TemplateBinding IsDropDownOpen}" AllowsTransparency="True" Focusable="False" PopupAnimation="Slide">
                            <Grid Name="DropDown" SnapsToDevicePixels="True" MinWidth="{TemplateBinding ActualWidth}" MaxHeight="{TemplateBinding MaxDropDownHeight}">
                                <Border x:Name="DropDownBorder" Background="#FFFFFFFF" BorderThickness="1" BorderBrush="#FF888888"/>
                                <ScrollViewer Margin="4,6,4,6" SnapsToDevicePixels="True">
                                    <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" />
                                </ScrollViewer>
                            </Grid>
                        </Popup>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="HasItems" Value="false">
                            <Setter TargetName="DropDownBorder" Property="MinHeight" Value="95"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <!--<Setter Property="Foreground" Value="{StaticResource DisabledForegroundBrush}"/>-->
                            <Setter Property="Foreground" Value="#888"/>
                        </Trigger>
                        <Trigger Property="IsGrouping" Value="true">
                            <Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
                        </Trigger>
                        <Trigger SourceName="Popup" Property="Popup.AllowsTransparency" Value="true">
                            <Setter TargetName="DropDownBorder" Property="CornerRadius" Value="4"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    
    <!-- 
    *****************************************************************
    ScrollBar Template
    *****************************************************************
    -->
    <Style x:Key="ScrollBarPageButton" TargetType="{x:Type RepeatButton}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="IsTabStop" Value="false"/>
        <Setter Property="Focusable" Value="false"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Border Background="Transparent"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="HorizontalScrollBarThumb" TargetType="{x:Type Thumb}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="IsTabStop" Value="false"/>
        <Setter Property="Focusable" Value="false"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Grid Background="Transparent">
                        <!--<Border Height="12" Background="#FFF" BorderThickness="0.5,1" CornerRadius="3"/>-->
                        <Border Height="12" Background="#7B7B7B" BorderThickness="1,0.5"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="VerticalScrollBarThumb" TargetType="{x:Type Thumb}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="IsTabStop" Value="false"/>
        <Setter Property="Focusable" Value="false"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Grid Background="Transparent">
                        <!--<Border Width="12" Background="#FFF" BorderThickness="1,0.5" CornerRadius="3"/>-->
                        <Border Width="12" Background="#7B7B7B" BorderThickness="1,0.5"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <ControlTemplate x:Key="VerticalScrollBar" TargetType="{x:Type ScrollBar}">
        <Grid Width="12">
            <Border Width="12" Background="#18000000" />

            <Track Name="PART_Track" IsDirectionReversed="true">
                <Track.DecreaseRepeatButton>
                    <RepeatButton Command="ScrollBar.PageUpCommand" Style="{StaticResource ScrollBarPageButton}"/>
                </Track.DecreaseRepeatButton>
                <Track.Thumb>
                    <Thumb x:Name="Thumb" Opacity="0.65" Style="{StaticResource VerticalScrollBarThumb}"/>
                </Track.Thumb>
                <Track.IncreaseRepeatButton>
                    <RepeatButton Command="ScrollBar.PageDownCommand" Style="{StaticResource ScrollBarPageButton}"/>
                </Track.IncreaseRepeatButton>
            </Track>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Trigger.EnterActions>
                    <BeginStoryboard>
                        <Storyboard>
                            <DoubleAnimation Duration="0:0:0.25" Storyboard.TargetName="Thumb" Storyboard.TargetProperty="Opacity" To="1"/>
                        </Storyboard>
                    </BeginStoryboard>
                </Trigger.EnterActions>
                <Trigger.ExitActions>
                    <BeginStoryboard>
                        <Storyboard>
                            <DoubleAnimation Duration="0:0:0.25" Storyboard.TargetName="Thumb" Storyboard.TargetProperty="Opacity"/>
                        </Storyboard>
                    </BeginStoryboard>
                </Trigger.ExitActions>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <ControlTemplate x:Key="HorizontalScrollBar" TargetType="{x:Type ScrollBar}">
        <Grid Height="12">
            <Border Height="12" Background="#18000000" />
            <Track Name="PART_Track" IsDirectionReversed="false">
                <Track.DecreaseRepeatButton>
                    <RepeatButton Command="ScrollBar.PageUpCommand" Style="{StaticResource ScrollBarPageButton}"/>
                </Track.DecreaseRepeatButton>
                <Track.Thumb>
                    <Thumb x:Name="Thumb" Opacity="0.65" Style="{StaticResource HorizontalScrollBarThumb}"/>
                </Track.Thumb>
                <Track.IncreaseRepeatButton>
                    <RepeatButton Command="ScrollBar.PageDownCommand" Style="{StaticResource ScrollBarPageButton}"/>
                </Track.IncreaseRepeatButton>
            </Track>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Trigger.EnterActions>
                    <BeginStoryboard>
                        <Storyboard>
                            <DoubleAnimation Duration="0:0:0.25" Storyboard.TargetName="Thumb" Storyboard.TargetProperty="Opacity" To="1"/>
                        </Storyboard>
                    </BeginStoryboard>
                </Trigger.EnterActions>
                <Trigger.ExitActions>
                    <BeginStoryboard>
                        <Storyboard>
                            <DoubleAnimation Duration="0:0:0.25" Storyboard.TargetName="Thumb" Storyboard.TargetProperty="Opacity"/>
                        </Storyboard>
                    </BeginStoryboard>
                </Trigger.ExitActions>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <Style TargetType="{x:Type ScrollBar}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="Template" Value="{StaticResource VerticalScrollBar}"/>
        <Style.Triggers>
            <Trigger Property="Orientation" Value="Horizontal">
                <Setter Property="Template" Value="{StaticResource HorizontalScrollBar}"/>
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style TargetType="{x:Type ScrollViewer}">
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ScrollViewer}">
                    <Grid x:Name="Grid" Background="Transparent">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>

                        <Grid.RowDefinitions>
                            <RowDefinition Height="*"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>

                        <ScrollContentPresenter x:Name="PART_ScrollContentPresenter" Margin="0,0,4,0" CanHorizontallyScroll="False" CanVerticallyScroll="False"/>
                        <ScrollBar x:Name="PART_VerticalScrollBar" Grid.Column="1" Grid.Row="0" Margin="0,4,4,4" AutomationProperties.AutomationId="VerticalScrollBar" 
                                   Maximum="{TemplateBinding ScrollableHeight}" Minimum="0"
                                   Value="{Binding Path=VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" 
                                   ViewportSize="{TemplateBinding ViewportHeight}" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"/>

                        <ScrollBar x:Name="PART_HorizontalScrollBar" Grid.Column="0" Grid.Row="1" Margin="4,0,4,4" AutomationProperties.AutomationId="HorizontalScrollBar" 
                                   Maximum="{TemplateBinding ScrollableWidth}" Minimum="0"
                                   Orientation="Horizontal"
                                   Value="{Binding Path=HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" 
                                   ViewportSize="{TemplateBinding ViewportWidth}" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"/>
                    </Grid>
                    <!--<ControlTemplate.Triggers>
                        <Trigger SourceName="PART_VerticalScrollBar" Property="Visibility" Value="Visible">
                            <Setter TargetName="PART_ScrollContentPresenter" Property="Margin" Value="0,0,-4,0" />
                        </Trigger>
                        <Trigger SourceName="PART_HorizontalScrollBar" Property="Visibility" Value="Visible">
                            <Setter TargetName="PART_ScrollContentPresenter" Property="Margin" Value="0,0,0,-4" />
                        </Trigger>
                    </ControlTemplate.Triggers>-->
                    <ControlTemplate.Triggers>
                        <Trigger SourceName="PART_VerticalScrollBar" Property="Visibility" Value="Visible">
                            <Setter TargetName="PART_ScrollContentPresenter" Property="Margin" Value="0,0,2,0" />
                        </Trigger>
                    </ControlTemplate.Triggers>

                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>





</ResourceDictionary>